/*
 * 消息/待办事项
 *
 * @Author:
 * @Date: 
 * @Wechat: 
 * @Email: 
 * @Copyright 
 */
import _ from 'lodash';
import { defineStore } from 'pinia';
import { getMessage, setMessage, removeMessage } from "/@/utils/storage";

export const useMessageStore = defineStore({
    id: 'message',
    state: () => ({
        messageList: getMessage() || []
    }),
    getters: {
        messageList(state) {
            return state.messageList || getMessage() || [];
        }
    },
    actions: {
        setMessage(message) {
            this.messageList = message;
            setMessage(message);
        },
        removeMessage() {
            removeMessage();
            this.messageList = [];
        }
    },
});
